home *** CD-ROM | disk | FTP | other *** search
/ PC PowerPlay 58 / pcpp58a.iso / extras / quake 3 source / Q3A_ToolSource.exe / Main / IMessaging.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-02  |  3.6 KB  |  98 lines

  1. //-----------------------------------------------------------------------------
  2. //
  3. // $LogFile$
  4. // $Revision: 1.1.2.1 $
  5. // $Author: ttimo $
  6. // $Date: 2000/02/04 22:59:34 $
  7. // $Log: IMessaging.h,v $
  8. // Revision 1.1.2.1  2000/02/04 22:59:34  ttimo
  9. // messaging API preview
  10. //
  11. //
  12. // DESCRIPTION:
  13. // interface for all-purpose messaging in Radiant
  14.  
  15. #ifndef __IMESSAGING_H_
  16. #define __IMESSAGING_H_
  17.  
  18. // this one can be hooked in the GL window procs for customizing GUI through plugins
  19. class IWindowListener
  20. {
  21. public:
  22.     // Increment the number of references to this object
  23.     virtual void IncRef () = 0;
  24.     // Decrement the reference count
  25.     virtual void DecRef () = 0;
  26.     // since Radiant is MFC we don't use a WNDPROC, we wrap the MFC handlers
  27.     // the handler is called first, if returns false Radiant continues processing
  28.     //++timo maybe add more later ? OnKeyUp and OnKeyDown for instance
  29.     //++timo TODO: add handlers everywhere
  30.     virtual bool OnLButtonDown(UINT nFlags, int x, int y) = 0;
  31.     virtual bool OnMButtonDown(UINT nFlags, int x, int y) = 0;
  32.     virtual bool OnRButtonDown(UINT nFlags, int x, int y) = 0;
  33.     virtual bool OnLButtonUp(UINT nFlags, int x, int y) = 0;
  34.     virtual bool OnMButtonUp(UINT nFlags, int x, int y) = 0;
  35.     virtual bool OnRButtonUp(UINT nFlags, int x, int y) = 0;
  36.     virtual bool OnMouseMove(UINT nFlags, int x, int y) = 0;
  37. };
  38.  
  39. // various Radiant messages --------
  40. // this one holds the total number of supported messages (this is used to allocate structs)
  41. #define RADIANT_MSGCOUNT 3
  42. // they start with a 0, can be indexed in an array
  43. // something was selected / deselected
  44. #define RADIANT_SELECTION 0
  45. // a brush face was selected / deselected
  46. #define RADIANT_SFACE     1
  47. // current texture / shader changed
  48. #define RADIANT_TEXTURE   2
  49.  
  50. // this one can be used to listen for Radiant-specific events
  51. class IListener
  52. {
  53. public:
  54.     // Increment the number of references to this object
  55.     virtual void IncRef () = 0;
  56.     // Decrement the reference count
  57.     virtual void DecRef () = 0;
  58.     // message is one of the RADIANT_* consts
  59.     virtual void DispatchRadiantMsg( int Msg ) = 0;
  60. };
  61.  
  62. // this one is provided by Radiant, it's a wrapper for some usefull functions
  63. class IXYWndWrapper
  64. {
  65. public:
  66.     virtual void SnapToGrid( int x1, int y1, vec3_t pt ) = 0;
  67. };
  68.  
  69. // define a GUID for this interface so plugins can access and reference it
  70. // {41FD005C-D36B-11d3-A3E9-0004AC96D4C3}
  71. static const GUID QERMessaging_GUID = 
  72. { 0x41fd005c, 0xd36b, 0x11d3, { 0xa3, 0xe9, 0x0, 0x4, 0xac, 0x96, 0xd4, 0xc3 } };
  73.  
  74. // will hook the given IWindowListener to the XY window and increment the ref count
  75. //++timo TODO: add hooking in the CAM view and Z view
  76. typedef void (WINAPI* PFN_QERAPP_HOOKWINDOW)    (IWindowListener *);
  77. // will unhook the given IWindowListener
  78. typedef void (WINAPI* PFN_QERAPP_UNHOOKWINDOW)    (IWindowListener *);
  79. // to retrieve the IXYWndWrapper
  80. typedef IXYWndWrapper* (WINAPI* PFN_QERAPP_GETXYWNDWRAPPER)    ();
  81.  
  82. // will hook a given listener into Radiant listening for the given message and increment ref count
  83. // call several times to listen for several messages
  84. typedef void (WINAPI* PFN_QERAPP_HOOKLISTENER)    (IListener *, int Msg);
  85. // will unhook the listener and return the number of messages the given listener was removed from
  86. typedef int  (WINAPI* PFN_QERAPP_UNHOOKLISTENER)(IListener *);
  87.  
  88. struct _QERMessagingTable
  89. {
  90.     int m_nSize;
  91.     PFN_QERAPP_HOOKWINDOW        m_pfnHookWindow;
  92.     PFN_QERAPP_UNHOOKWINDOW        m_pfnUnHookWindow;
  93.     PFN_QERAPP_GETXYWNDWRAPPER    m_pfnGetXYWndWrapper;
  94.     PFN_QERAPP_HOOKLISTENER        m_pfnHookListener;
  95.     PFN_QERAPP_UNHOOKLISTENER    m_pfnUnHookListener;
  96. };
  97.  
  98. #endif